package comman.duke 
{
	import flash.utils.getQualifiedClassName;
	/**
	 * ...
	 * use with mgr.ObjectPools
	 * @author jerry.d
	 */
	public class Pool 
	{
		public var claz:Class;
		public var classKey:String;
		public var list:Array;
		public function Pool(clas:Class) 
		{
			this.classKey = getQualifiedClassName(claz);
			this.claz = clas;
			this.list = [];
		}
		
		public function reclaim(obj:*):void{
			//todo check type == claz or classKey
			if ( this.list.indexOf(obj) == -1){
				//obj.destroy();
				list.push(obj);
			}
		}
		
		public function gain():*{
			if ( list.length != 0 ){
				return list.shift();
			}
			return new claz();
		}
	}

}